package com.sixuerain.heartkey.prayer.db;

import com.sixuerain.heartkey.prayer.db.model.ReadRecordModel;
import com.sixuerain.heartkey.prayer.db.table.ReaderRecordTable;

import android.content.Context;
import android.database.Cursor;

public class ReaderRecordDAO extends BaseDAO<ReadRecordModel> {

	public ReaderRecordDAO(Context context) {
		super(context);
	}

	@Override
	public ReadRecordModel mapRow(Cursor cursor, int rowNum) {
		ReadRecordModel readRecord = new ReadRecordModel();
		readRecord.setHomeworkID(cursor.getInt(
				cursor.getColumnIndex(ReaderRecordTable.HOMEWORKID)));
		readRecord.setLectionID(cursor.getInt(
				cursor.getColumnIndex(ReaderRecordTable.LECTION)));
		readRecord.setLectionTitle(cursor.getString(
				cursor.getColumnIndex(ReaderRecordTable.LECTION_TITLE)));
		
		readRecord.setReadtimes(cursor.getInt(
				cursor.getColumnIndex(ReaderRecordTable.READTIMES)));
		
		readRecord.setTotalReadtimes(cursor.getInt(
				cursor.getColumnIndex(ReaderRecordTable.TOTALREADTIMES)));
		
		readRecord.setReaderId(cursor.getInt(
				cursor.getColumnIndex(ReaderRecordTable.READER)));
		
		return readRecord;
	}

}
